//
//  addMoreController.m
//  PaiQuan
//
//  Created by Mac on 16/7/12.
//  Copyright © 2016年 huigu. All rights reserved.
//

#import "addMoreController.h"
#import "nominateFriendController.h"
@interface addMoreController ()

@end

@implementation addMoreController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.tableView.backgroundColor = PQ_COLOR_LightGray;
    self.titleView.title = @"更多";
    [self.titleView.btnBack setImage:PQIMG(@"back") forState:UIControlStateNormal];
    [self.titleView.btnBack setTitle:@"返回" forState:UIControlStateNormal];
    [self.titleView.btnBack setTitleColor:PQ_COLOR_YELLOW forState:UIControlStateNormal];
    

 
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 2;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 1;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    static NSString *ID = @"id";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:ID];
        if (indexPath.section == 0) {
            cell.textLabel.text = @"备注";
        }else{
            cell.textLabel.text = @"推荐该好友至";
        }
        cell.accessoryType =  UITableViewCellAccessoryDisclosureIndicator;
     
    }
    return cell;
}
-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
   
    
    UIView *footerView = [[UIView alloc] init];
    
   
    if (section == 1) {
        UIButton *delegeteBtn = [[UIButton alloc] init];
        
        [delegeteBtn setTitle:@"删除好友" forState:UIControlStateNormal];
        [delegeteBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        delegeteBtn.layer.cornerRadius = RATIO(8);
        delegeteBtn.layer.masksToBounds = YES;
        delegeteBtn.titleLabel.font = FONT(15);
        delegeteBtn.backgroundColor = [UIColor redColor];
        [footerView addSubview:delegeteBtn];
        [delegeteBtn makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(footerView.top).offset(RATIO(92));
            make.centerX.equalTo(footerView);
            make.width.equalTo(RATIO(400));
            make.height.equalTo(RATIO(72));
        }];
        
        return footerView;
        
    }else{
        
        return footerView;
    }
    
   
}

-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
    if (section ==1) {
        return RATIO(250);
    }else{
        return 0;
    }
   
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return RATIO(96);
}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    return RATIO(26);
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.section == 0) {
    
        UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"修改备注" message:@"给好友添加备注，方便您记住好友" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];
        
     
        alertView.alertViewStyle =   UIAlertViewStylePlainTextInput;
        [alertView show];
        
    }else{
        nominateFriendController *nomFriVC = [[nominateFriendController alloc] init];
        [self.navigationController pushViewController:nomFriVC animated:YES];
    }
    
    
}


@end
